package xh.lumt.server.store;

import org.mapdb.DB;
import org.mapdb.DBMaker;

import java.io.File;
import java.util.concurrent.ConcurrentNavigableMap;

/**
 * Created by HanXiong on 2016/9/23.
 */
public class MusicLinkStorage {

    private DB db;

    private ConcurrentNavigableMap<String, String> map;

    public MusicLinkStorage(String dbPath) {

        String dbName = dbPath + "/lumt.db";
        db = DBMaker.fileDB(new File(dbName))
                .closeOnJvmShutdown()
                .encryptionEnable("lumt")
                .make();
        map = db.treeMap("lumt");
    }

    public void add(String name, String url) {
        map.put(url, name);
        db.commit();
    }

    public void delete(String name, String url) {

    }
}
